<template>
  <view id="app">
    <view class="app-container">
      <!-- 添加星空背景 -->
      <view class="stars-background">
        <view 
          v-for="(star, index) in stars" 
          :key="index"
          class="star"
          :style="star.style"
        ></view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      stars: []
    }
  },
  onLaunch() {
    console.log('App Launch')
    // 生成星空背景
    this.generateStars()
  },
  onShow() {
    console.log('App Show')
  },
  onHide() {
    console.log('App Hide')
  },
  methods: {
    /**
     * 生成星空背景
     */
    generateStars() {
      const starCount = 100
      this.stars = []
      
      for (let i = 0; i < starCount; i++) {
        const size = Math.random() * 2 + 1
        const star = {
          style: {
            width: `${size}rpx`,
            height: `${size}rpx`,
            top: `${Math.random() * 100}%`,
            left: `${Math.random() * 100}%`,
            animationDelay: `${Math.random() * 5}s`,
            animationDuration: `${Math.random() * 3 + 2}s`
          }
        }
        this.stars.push(star)
      }
    }
  }
}
</script>

<style lang="scss">
/* 全局样式 */
@import 'uview-ui/index.scss';

/* 色彩变量 */
:root {
  --primary-bg: #0D1B2A;
  --secondary-bg: #1B263B;
  --lighter-bg: #415A77;
  --paper-bg: #FDFDF0;
  --accent-gold: #FFD700;
  --text-light: #E0E1DD;
  --text-dark: #778DA9;
  --text-on-paper: #333;
  --wechat-green: #07C160;
  --status-blue: #3498db;
  --status-green: #2ecc71;
  --status-grey: #95a5a6;
}

/* 全局字体 */
page {
  font-family: 'Noto Sans SC', sans-serif;
  background-color: var(--primary-bg);
  color: var(--text-light);
}

/* 应用容器 */
.app-container {
  position: relative;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
}

/* 星空背景 */
.stars-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.star {
  position: absolute;
  background-color: var(--text-light);
  border-radius: 50%;
  animation: twinkle 5s infinite;
}

@keyframes twinkle {
  0%, 100% { 
    opacity: 0.5; 
    box-shadow: 0 0 4rpx 0rpx var(--text-light); 
  }
  50% { 
    opacity: 1; 
    box-shadow: 0 0 10rpx 4rpx var(--text-light); 
  }
}

/* 全局按钮样式 */
.btn-primary {
  background-color: var(--accent-gold);
  color: var(--primary-bg);
  border-radius: 50rpx;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-primary:active {
  transform: scale(0.95);
}

.btn-primary:disabled {
  background-color: var(--text-dark);
  color: #aaa;
  cursor: not-allowed;
  opacity: 0.7;
}

/* 全局输入框样式 */
.input-primary {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--text-dark);
  border-radius: 20rpx;
  color: var(--text-light);
  padding: 30rpx;
}

.input-primary:focus {
  border-color: var(--accent-gold);
}

/* 全局卡片样式 */
.card-primary {
  background-color: rgba(27, 38, 59, 0.7);
  backdrop-filter: blur(30rpx);
  border-radius: 40rpx;
  border: 1px solid rgba(119, 141, 169, 0.3);
  box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.2);
}

/* 全局状态标签样式 */
.status-tag {
  padding: 8rpx 16rpx;
  border-radius: 12rpx;
  font-size: 24rpx;
  font-weight: 500;
}

.status-floating { 
  background-color: var(--status-blue); 
  color: white; 
}

.status-opened { 
  background-color: var(--status-green); 
  color: white; 
}

.status-lost { 
  background-color: var(--status-grey); 
  color: white; 
}

.status-collected { 
  background-color: var(--accent-gold); 
  color: var(--primary-bg); 
}

/* 全局文本样式 */
.text-primary {
  color: var(--text-light);
}

.text-secondary {
  color: var(--text-dark);
}

.text-on-paper {
  color: var(--text-on-paper);
}

.text-gold {
  color: var(--accent-gold);
}

/* 全局布局样式 */
.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

/* 全局安全区域适配 */
.safe-area-top {
  padding-top: env(safe-area-inset-top);
}

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

/* 全局页面动画 */
.page-enter-active {
  animation: pageEnter 0.5s ease-out;
}

.page-leave-active {
  animation: pageLeave 0.3s ease-in;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(20rpx);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pageLeave {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20rpx);
  }
}
</style> 